package com.core.image.core;

import java.io.IOException;
import java.io.OutputStream;

/**
 * describe:接受包的定義
 *
 * @author 库琦
 * @date 2020/01/24
 */
public abstract class ReceivePacket<Stream extends OutputStream,Entity> extends Packet<Stream>{

    private Entity entity;
    public Entity entity() {
        return entity;
    }

    public ReceivePacket(long len){
        this.length = len;
    }
    public abstract  Entity buildEntity(Stream stream);
    public void closeStream(Stream stream)throws IOException{
        super.closeStream(stream);
        entity = buildEntity(stream);
    }
}
